import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet("/login")
public class ControlLogin extends GenericServlet {
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws IOException, ServletException {
        String sx = servletRequest.getParameter("sx");
        String pwd = servletRequest.getParameter("pwd");
        System.out.println("sx = " + sx);
        System.out.println("pwd = " + pwd);
        //跳页
        HttpServletResponse res = (HttpServletResponse) servletResponse;
        servletRequest.setAttribute("姓名", 123);

        servletRequest.getRequestDispatcher("ok").forward(servletRequest, res);
////2.判断
//        if (sx.equals("111")&& pwd.equals("111")){
//            res.sendRedirect("sucess.jsp");
//        }else {
//            res.sendRedirect("fail.jsp");
//        }
    }
}
